import dbtest

dbtype = "mysql"
hostname = "db4free.net"
username = "userpython"
password = "python"
port = "3306"
dbname = "groupsixdatabase"

success = dbtest.init(dbtype, username, password, hostname, port, dbname)

john = dbtest.User('John', 42, 'pass')
mary = dbtest.User(name='Mary', age=30, password='secret')
jack = dbtest.User('Jack', 53)
tom = dbtest.User('Tom', 12, 'word')

#this gets modified on the database
john.name = 'Jon'

#To modify a age using the name for lookup
dbtest.getuser(name='Mary').age = 56

# get all the user info with name for lookup (useful for populating the user profile)
print "name=Tom: id=%d age=%d pass=%s" %(\
			dbtest.getuser(name='Tom').id, 
			dbtest.getuser(name='Tom').age, 
			dbtest.getuser(name='Tom').password )

#print the table (internal use only)
dbtest.printdbrows(dbtest.getusers())